
// 引入公共部分js
document.write('<script src="public/public.js"></script>');

$(document).ready(function(){

	// ------banner轮播图---------
	// 自动轮播
	var current = 0;
	var fun = function(){

		console.log(current);
		if(current>=7){
			current = 0;
			$('.slidebar ul li').eq(current).addClass('active').siblings().removeClass('active');
			$('.banner-box ul li').eq(7).fadeOut(800).end().eq(current).fadeIn(800);			
		}else{
			$('.slidebar ul li').eq(current+1).addClass('active').siblings().removeClass('active');
			$('.banner-box ul li').eq(current).fadeOut(800).end().eq(current+1).fadeIn(800);
			current++;			
		}
		
	}
	var time = setInterval(fun,4000);

	// hover轮播
	$('.slidebar ul li').hover(function(){		
		var index = $(this).index();
		console.log(index);
		$(this).addClass('active').siblings().removeClass('active');
		clearInterval(time);
		$('.banner-box ul li').eq(index).fadeIn(500).siblings().fadeOut(500);	
		current = index;	
	},function(){
		time = setInterval(fun,4000);
	})
	
	// 查看全部
	$('.quanbu').click(function(){
		$('.hide').css('display','block');
		$('.quanbu').css('display','none');
		$('.jingjian').css('display','block');
		})
	$('.jingjian').click(function(){
		$('.hide').css('display','none');
		$('.quanbu').css('display','block');
		$('.jingjian').css('display','none');
	})

	// 主要信息hover
	$('.product-list ul.content li').hover(function(){
		$(this).find('.view').css('display','none');
		$(this).find('.hover').css('display','block');
	},function(){
		$(this).find('.hover').css('display','none');
		$(this).find('.view').css('display','block');
	})

	// ajax异步提交表单
		$('.pn').click(function(){
			var username = $('#username').val();
			var password = $('#password').val();
			var param = {};
			param.username=username;
			param.password = password;
			// console.log(param);
			$.post('public/public_login.php',param,function(data){						
				if (data.code == 1) {
					alert('登录成功');				
					$('.wei_login').slideUp(500);
				}else{
					alert('登录失败');
					$('.wei_login').css('display','block');
					$('#username').val('');
					$('#password').val('');
				}
			},'json');
		})

})

// angularJS
var app = angular.module('myApp',[]);
	app.controller('myCtrl',function($scope){
		$scope.arr = [
			{'name':'运动手环'},{'name':'智能手表'},{'name':'智能影音'},
			{'name':'智能家居'},{'name':'健康医疗'},{'name':'母婴儿童'},
			{'name':'智驾设备'},{'name':'智能硬件'},{'name':'智能办公'},
			{'name':'智能眼镜'},{'name':'智能追踪'},{'name':'美容瘦身'},
			{'name':'智能饰品'},{'name':'智能穿戴'},{'name':'智能玩具'},
			{'name':'宠物设备'},{'name':'智能情趣'},{'name':'智能照明'},
			{'name':'3D打印'},{'name':'代步车'},{'name':'无人机'},{'name':'机器人'}
		]
		$scope.arr1 = [
			{'price':'0~200元'},{'price':'200~400元'},{'price':'400~600元'},
			{'price':'600~800元'},{'price':'800~1000元'},{'price':'1000~2000元'},
			{'price':'2000~3000元'},{'price':'3000以上'}			
		]
		$scope.arr2 = [
			{'stage':'创意中'},{'stage':'研发中'},{'stage':'众筹中'},
			{'stage':'可预定'},{'stage':'已量产可购买'}					
		]
		$scope.arr3 = [
			{'support':'安卓设备'},{'support':'iphone设备'},{'support':' Windows phone设备'},
			{'support':'黑莓设备'},{'support':'其他设备'}			
		]
		$scope.arr4 = [
			{'feature':'麦克'},{'feature':'天气'},{'feature':'秒表'},
			{'feature':'时间日历'},{'feature':'闹钟提醒'},{'feature':'指南针'},
			{'feature':'数独游戏'},{'feature':'音乐播放'},{'feature':'扬声器'},
			{'feature':'视频播放'},{'feature':'语音助手'},{'feature':'720P摄像'},
			{'feature':'自动对焦'},{'feature':'震动提醒'},{'feature':'多点触控'},
			{'feature':'短信提醒'},{'feature':'支持三方应用'},{'feature':'配件更换'},
			{'feature':'主题设定'},{'feature':'LED电子照明'},{'feature':'卡路里摄入'},
			{'feature':'心跳数据'},{'feature':'计步器'},{'feature':'健康数据控制'},
			{'feature':'紧急求救功能'},{'feature':'睡眠监测'},{'feature':'智能省电'},
			{'feature':'拾音技术'},{'feature':'GPS定位'},{'feature':'蜂鸣器报警'}
		]
		$scope.arr5 = [
			{'img':'1','title':'求职招聘','have':'30','focus':'137','brand':'','time':'','price':'0'},
			{'img':'2','title':'实名认证会员','have':'38','focus':'137','brand':'','time':'','price':'0'},
			{'img':'3','title':'Omate TrueSmart智能手表','have':'30','focus':'137','brand':'','time':'','price':'1888'},
			{'img':'4','title':'Apple 苹果  iWatch 智能手表','have':'30','focus':'137','brand':'','time':'未上市','price':'1999'},
			{'img':'5','title':'Agent 智能手表','have':'30','focus':'137','brand':'','time':'','price':'1688'},
			{'img':'6','title':'IHealth AM3 智能手表','have':'22','focus':'1227','brand':'映趣','time':'2013-11','price':'349'},
			{'img':'7','title':'ILing 智能手表','have':'26','focus':'357','brand':'','time':'','price':'559'},
			{'img':'8','title':'神行者 智能手表','have':'37','focus':'166','brand':'','time':'2013-08-09','price':'1999'},
			{'img':'9','title':'PISIN 派信 智能手表','have':'23','focus':'213','brand':'','time':'2013-08-09','price':'234'},
			{'img':'10','title':'喜越智能手表','have':'37','focus':'235','brand':'','time':'2014-01-09','price':'678'},
			{'img':'11','title':'Smart Q 智器手表','have':'7','focus':'75','brand':'','time':'2012-02-09','price':'1899'},
			{'img':'12','title':'高通 智能手表','have':'45','focus':'56','brand':'高通','time':'2013-04-09','price':'1588'},
			{'img':'13','title':'Couvezi 国为手表','have':'76','focus':'234','brand':'','time':'2012','price':'588'},
			{'img':'14','title':'Samsung 三星智能手表','have':'34','focus':'166','brand':'','time':'2011','price':'1458'},
			{'img':'15','title':'LEISE 雷摄 智能手表','have':'45','focus':'543','brand':'','time':'2013','price':'689'},
			{'img':'16','title':'Pebble smartwatch 智能手表','have':'77','focus':'134','brand':'','time':'2013-04-09','price':'1588'},
			{'img':'17','title':'Nike Sportwatch 耐克','have':'27','focus':'162','brand':'','time':'2014','price':'298'},
			{'img':'18','title':'索尼SmartWatch MN2','have':'23','focus':'123','brand':'','time':'2011','price':'488'},
			{'img':'19','title':'GEAK 果壳智能手表','have':'17','focus':'153','brand':'','time':'','price':'678'},
			{'img':'20','title':'Trakdot 智能手表','have':'23','focus':'162','brand':'','time':'2013-04-09','price':'999'},
			{'img':'9','title':'PISIN 派信 智能手表','have':'23','focus':'213','brand':'','time':'2013-08-09','price':'234'},
			{'img':'10','title':'喜越智能手表','have':'37','focus':'235','brand':'','time':'2014-01-09','price':'678'},
			{'img':'11','title':'Smart Q 智器手表','have':'7','focus':'75','brand':'','time':'2012-02-09','price':'1899'},
			{'img':'12','title':'高通 智能手表','have':'45','focus':'56','brand':'高通','time':'2013-04-09','price':'1588'},
			{'img':'13','title':'Couvezi 国为手表','have':'76','focus':'234','brand':'','time':'2012','price':'588'},
			{'img':'14','title':'Samsung 三星智能手表','have':'34','focus':'166','brand':'','time':'2011','price':'1458'},
			{'img':'15','title':'LEISE 雷摄 智能手表','have':'45','focus':'543','brand':'','time':'2013','price':'689'},
			{'img':'16','title':'Pebble smartwatch 智能手表','have':'77','focus':'134','brand':'','time':'2013-04-09','price':'1588'},
			{'img':'17','title':'Nike Sportwatch 耐克','have':'27','focus':'162','brand':'','time':'2014','price':'298'},
			{'img':'18','title':'索尼SmartWatch MN2','have':'23','focus':'123','brand':'','time':'2011','price':'488'},
			{'img':'19','title':'GEAK 果壳智能手表','have':'17','focus':'153','brand':'','time':'','price':'678'},
			{'img':'20','title':'Trakdot 智能手表','have':'23','focus':'162','brand':'','time':'2013-04-09','price':'999'},



		]

	})